import { createI18n } from 'vue-i18n'
import Cookies from 'js-cookie'

//英文包
import enLocale from './lang/en'
//中文包
import zhLocale from './lang/zh-CN'

//获取语言类型
function InitLanguage() {
  return Cookies.get('DefaultLanguage') == null ? 'zh-CN' : Cookies.get('DefaultLanguage')
}

//配置多语言
export default createI18n({
  legacy: false,
  locale: InitLanguage(),
  messages: {
    en: enLocale,
    'zh-CN': zhLocale,
  },
})
